package day15.day15_2.string;

import org.junit.Test;

/**
 * @Auther:小陈的Java
 */
public class StringDemo1 {
    @Test
    public void stringTest1() {
        String s1 = "acb";
        String s2 = new String("acb");
        System.out.println(s1 == s2);
    }

    @Test
    public void stringTest2() {
        String s1 = "acb";
        String s2 = new String("acb");
        System.out.println(s1 == s2);
    }
    @Test
    public void stringTest3() {
        String s1 = "abcd";
        String s2 = "ab";
        String s3 = "cd";
        System.out.println(s1 == "ab"+"cd");
        System.out.println(s1=="ab" +s3);
        System.out.println(s1 == s1+s2);
        System.out.println(s1 == (s1+s2).intern());
    }
    @Test
    public void stringTest4() {
        final String s1 = "abcd";
        final String s2 = "ab";
        final String s3 = "cd";
        System.out.println(s1 == s2+s3);
    }
}
